package com.seari.Utils;

import java.util.List;

public class StringUtils {

	/**
	 * String数组转int数组
	 * 
	 * @param arrs
	 * @return
	 */
	public static int[] StringToInt(String[] arrs) {
		int[] ints = new int[arrs.length];
		for (int i = 0; i < arrs.length; i++) {
			ints[i] = Integer.parseInt(arrs[i]);
		}
		return ints;

	}
	
	/**
	 * 判断设备的状态，0为正常值，1错误
	 * @param list
	 * @return
	 */
	public static boolean deviceStatus0(List<String> list) {
		boolean status = false;

		for (int i = 0; i < list.size(); i++) {
			if (list.get(i) != null && "0".equals(list.get(i))) {
				status = true;
			} else if (list.get(i) != null && "1".equals(list.get(i))) {
				status = false;
				break;
			}
		}

		return status;
	}
	
	/**
	 * 判断设备的状态，1为正常值，0错误
	 * @param list
	 * @return
	 */
	public static boolean deviceStatus1(List<String> list) {
		boolean status = false;

		for (int i = 0; i < list.size(); i++) {
			if (list.get(i) != null && "1".equals(list.get(i))) {
				status = true;
			} else if (list.get(i) != null && "0".equals(list.get(i))) {
				status = false;
				break;
			}
		}

		return status;
	}
}
